/*
 * @Description: 宠物档案
 * @Author: zhaolei
 * @Date: 2023-04-17 10:49:42
 */

import request from '@/router/axios';

// 用户宠物档案分页查询
export function fetchList(params) {
  return request({
    url: '/core/pet/info/platform/page/user',
    method: 'get',
    params,
  });
}

// 通过id查询宠物档案详情
export function getObj(id) {
  return request({
    url: `/core/pet/info/${id}`,
    method: 'get',
  });
}

// 基地宠物档案分页查询
export function fetchBasePetList(data) {
  return request({
    url: '/core/pet/info/platform/page/base',
    method: 'post',
    data,
  });
}

// 新增基地宠物档案
export function addObj(data) {
  return request({
    url: '/core/pet/info/platform',
    method: 'post',
    data,
  });
}

// 编辑基地宠物档案
export function editObj(data) {
  return request({
    url: '/core/pet/info/platform',
    method: 'put',
    data,
  });
}

// 删除基地宠物档案
export function delObj(id) {
  return request({
    url: `/core/pet/info/${id}`,
    method: 'delete',
  });
}

// 上架宠物
export function putAway(data) {
  return request({
    url: `/core/pet/info/platform/up`,
    method: 'put',
    data,
  });
}

// 下架宠物
export function takeDown(data) {
  return request({
    url: `/core/pet/info/platform/down`,
    method: 'put',
    data,
  });
}

// 查询宠物最新上架记录
export function getShelfRecord(petId) {
  return request({
    url: `/core/shelf/record/platform/${petId}`,
    method: 'get',
  });
}

/**
 * 上架宠物
 */
export function upPet(petId) {
  return request({
    url: `/core/pet/info/up/${petId}`,
    method: 'put',
  });
}

// 屏蔽宠物
export function shieldPet(petId) {
  return request({
    url: `/core/pet/info/platform/shield/${petId}`,
    method: 'put',
  });
}

// 恢复宠物
export function recoverPet(petId) {
  return request({
    url: `/core/pet/info/platform/recover/${petId}`,
    method: 'put',
  });
}

// 根据宠物id查询宠物事项列表
export function getPetMatter(petId) {
  return request({
    url: `/core/pet/matters/manage/list/${petId}`,
    method: 'get',
  });
}

// 标记完成宠物事项列表
export function finishPetMatter(data) {
  return request({
    url: `/core/pet/matters/complete`,
    method: 'put',
    data,
  });
}

// 根据宠物事项id获取宠物事项详情
export function getPetMatterDetail(id) {
  return request({
    url: `/core/pet/matters/${id}`,
    method: 'get',
  });
}

// 修改宠物事项
export function editPetMatter(data) {
  return request({
    url: `/core/pet/matters`,
    method: 'put',
    data,
  });
}
//回归喵星
export function returnMeowStar(data) {
  return request({
    url: '/core/pet/info/return/meow/star',
    method: 'put',
    data,
  });
}
//更新故事
export function updateStory(data) {
  return request({
    url: '/core/shelf/record/update/story',
    method: 'put',
    data,
  });
}

//置顶
export function topPetBase(data) {
  return request({
    url: `/core/shelf/record/top`,
    method: 'put',
    data,
  });
}

/**
 * 获取宠物的获捐信息
 */
export function getDonateByPet(params) {
  return request({
    url: '/shop-core/donate/page/byPet',
    method: 'get',
    params,
  });
}

// 根据基地id获取云养区域
export function fetchCloudAreaListByBaseId(params) {
  return request({
    url: '/core/cloud/adopt/area/list',
    method: 'get',
    params,
  });
}
